﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;

namespace ConsoleClient
{
    class Broadcast : MarshalByRefObject, IBroadcast
    {
        public List<string> _messages = new List<string>(); 

        public void Send(string message)
        {
            _messages.Add(message);
        }

        public List<string> GetResentMessages()
        {
            List<string> resentMsgs;
            lock (_messages)
            {
                resentMsgs = (_messages as IEnumerable<string>).Reverse().Take(10).ToList();
            }
            return resentMsgs;
        }

        public override object InitializeLifetimeService()
        {
            return null;
        }
    }
}
